package com.kingsoft.dc.khaos.scheduler

import com.kingsoft.dc.khaos.metadata.{ModuleCommon, TaskInfo}

/**
  * Created by chengguangqing on 2019/5/27.
  */
private[scheduler] sealed trait KhaosSchedulerEvent


//application
private[scheduler] case class ApplicationSubmitted(applicationId:Int,
                                                   module:List[ModuleCommon],
                                                   listener: ApplicationListener
                                                  ) extends KhaosSchedulerEvent

private[scheduler] case class ApplicationCompleted(applicationId:Int,
                                                   completedTime:Long,
                                                   applicationResult: ApplicationResult,
                                                   listener: ApplicationListener
                                                  ) extends KhaosSchedulerEvent

private[scheduler] case class ApplicationCancelled(applicationId:Int
                                          )extends KhaosSchedulerEvent


//Job
private[scheduler] case class JobSubmitted(jobId: Int,
                                           modules:List[ModuleCommon],
                                           listener: ApplicationListener
                                          )extends KhaosSchedulerEvent

private[scheduler] case class JobCompleted(jobId:Int,
                                           completedTime:Long,
                                           jobResult: JobResult,
                                           listener: ApplicationListener
                                          ) extends KhaosSchedulerEvent

private[scheduler] case class JobCancelled(jobId:Int
                                          )extends KhaosSchedulerEvent


//Task
private[scheduler] case class TaskSubmitted(taskId:Int,
                                            modules:ModuleCommon,
                                            taskInfos:TaskInfo,
                                            listener: ApplicationListener
                                           )extends KhaosSchedulerEvent

private[scheduler] case class TaskResultCollector(taskInfo:TaskInfo,
                                                  listener: ApplicationListener
                                                 )extends KhaosSchedulerEvent

private[scheduler] case class TasksCancelled(taskId:Int
                                          )extends KhaosSchedulerEvent

private[scheduler] case class TaskFailed(taskInfo:TaskInfo,
                                         exception: Option[Exception]
                                        ) extends KhaosSchedulerEvent

